# encoding: utf-8

import json
import os
from init import project_path


class SqlLoginDataType:
    """
    数据库登录信息
    """
    name:str
    host:str
    port:int
    user:str
    password:str
    database:str

    def __init__(self):
        # print(project_path)
        config_path = os.path.join(project_path, 'Config/sql.config')
        with open(config_path, 'r') as f:
            data = json.load(f)

        # 数据库类型
        name = data.get('name')


        # 主机名


        # 端口号


        # 用户名


        # 密码


        # 数据库名


        self.name = data.get('name')
        self.host = data.get('host')
        self.port = data.get('port')
        self.user = data.get('user')
        self.password = data.get('password')
        self.database = data.get('database')


if __name__ == '__main__':
    sql = SqlLoginDataType()
    print(sql.host, sql.port, sql.user, sql.password, sql.database)
